#!/bin/bash

# 编译和运行脚本

echo "🔧 编译四维量子引擎..."

# 检查Go环境
if ! command -v go &> /dev/null; then
    echo "❌ 错误: 未找到Go环境，请先安装Go 1.21+"
    exit 1
fi

# 下载依赖
echo "📦 下载依赖..."
go mod download
go mod tidy

# 编译
echo "⚙️  编译中..."
go build -o bin/quantum-server cmd/quantum-server/main.go

if [ $? -eq 0 ]; then
    echo "✅ 编译成功！"
    echo ""
    echo "运行命令: ./bin/quantum-server"
    echo "或者直接运行: go run cmd/quantum-server/main.go"
else
    echo "❌ 编译失败"
    exit 1
fi
